<style lang="scss" scoped>
	.content {
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.box {
		width: 690rpx;
		padding: 30rpx 20rpx;
		background: #ffffff;
		border-radius: 20rpx;
		box-shadow: 0rpx 32rpx 20rpx -20rpx #e6ebf2;
		margin-top: 30rpx;

		.line {
			width: 100%;
			height: 100rpx;
			border-top: 1px solid #eeeeee;

			.f28 {
				width: 50%;
			}
		}

		.line2 {
			width: 100%;
			border-top: 1px solid #eeeeee;
			align-items: flex-start;

			.des {
				width: 520rpx;
				text-align: justify;
			}
		}

		.sbtn {
			width: 184rpx;
			height: 64rpx;
			background: #fffefe;
			border: 2rpx solid #409eff;
			border-radius: 34rpx;
		}

		.imgboxs {
			width: 100%;
			flex-wrap: wrap;

			.imgbox {
				width: 148rpx;
				height: 148rpx;
				border: 2rpx solid #dee2ee;
				border-radius: 10rpx;
				position: relative;
				margin-right: 18rpx;

				.photo {
					width: 100%;
					height: 100%;

				}

				.close {
					position: absolute;
					width: 32rpx;
					height: 32rpx;
					right: -16rpx;
					top: -16rpx;
				}
			}

			.imgbox:nth-child(4n) {

				margin-right: 0rpx;
			}
		}
	}

	.lbtn {
		margin: 60rpx auto;
	}

	.h1 {
		border-left: 6rpx solid #409eff;
		padding: 0 20rpx;
		margin-bottom: 20rpx;
		transform: translateX(-20rpx);
	}
</style>

<template>
	<view class="content">
		<view class="box p-bottom30">
			<view class="f32 bold textColor">基础信息</view>
			<u-line margin="30rpx 0"></u-line>
			<view class="gray align-flex m-top30">
				<view>编号</view>
				<view class="textColor p-left20">{{info.code}}</view>
			</view>
			<view class="gray align-flex m-top30">
				<view>名称</view>
				<view class="textColor p-left20">{{info.name}}</view>
			</view>
		</view>
		<view class="box">
			<view class="f32 bold textColor">巡检内容</view>
		</view>
		<view class="box" v-for="item,index in info.details" :key="index">
			<view class="f28 h1 bold textColor m-bottom30">{{item.inspectionRemark}}</view>
			<view class="line between-flex">
				<view class="f28 align-flex">
					<view class="gray m-right20">实测值</view>
					<view class="textColor">{{item.writeValue}}<span class="p-left10" v-if="item.valueUnit">{{item.valueUnit | valueUnit}}</span></view>
				</view>
				<view class=" f28 align-flex">
					<view class="gray m-right20">最终结果</view>
					<view class="textColor">{{item.processResult==1?'正常':'异常'}}
					</view>
				</view>
			</view>

			<view class="line2 between-flex f28 p-top20" v-if="item.processRemark">
				<view class="gray">整改意见</view>
				<!-- <textarea  class="des textColor" value="" placeholder="请输入整改意见" /> -->
				<view class="des textColor">{{item.processRemark}}</view>
			</view>
		</view>


		<view class="box">
			<view class="f32 bold textColor m-bottom30">巡检信息</view>
			<view class="line align-flex f28">
				<view class="gray m-right20">最终结果</view>
				<view class="textColor">{{info.result==1?'正常':'异常'}}
				</view>
			</view>
			<view v-if="info.result!=1">
				<view class="line align-flex f28" v-if="info.faultType">
					<view class="gray m-right20">巡检异常处理方法</view>
					<view class="textColor">{{dic_errorMake[info.faultType].name}}
					</view>
				</view>
				<view class="line align-flex f28">
					<view class="gray m-right20">限期日期</view>
					<view class="textColor">{{info.rectificationTime/1000 | time}}
					</view>
				</view>

			</view>
			<view class="line2 between-flex f28 p-top20">
				<view class="gray">巡检说明</view>
				<view class="des textColor">{{info.faultRemark?info.faultRemark:'无'}}</view>
			</view>

		</view>

		<view class="box" v-if="info.processPhoto">
			<view class="m-bottom30 ">
				<view class="f32 bold textColor ">照片</view>
			</view>
			<view class="imgboxs flex">
				<view class="imgbox center-flex" v-for="item,index in info.processPhoto" :key="index" @click="$open(item.url)">
					<image class="photo" :src="item.url | imgUrl" mode=""></image>
				</view>
			</view>
		</view>
		<view style="height:100rpx;"></view>
	</view>
</template>

<script>
	import { dicList } from '@/filter/index.js'
	export default {
		data() {
			return {
				id: 0,
				info: {},
				dic_errorMake: dicList('errorMake'),
			}
		},

		filters: {

			imgUrl(val) {
				let path = uni.getStorageSync('imgUrl')
				return `${path}${val}`

			}

		},
		onLoad(e) {
			this.id = e.id
			this.getInfo()
		},
		methods: {
			getInfo() {
				this.$pop.ajaxPost('/bus/inspection/work/info', {
					id: this.id
				}).then(res => {
					this.info = res.body
					if (this.info.processPhoto) {
						this.info.processPhoto = JSON.parse(this.info.processPhoto)
					}
				})
			}

		}
	}
</script>
